import time
#装饰器类metric
def metric(fn):
    start_time = time.time()
    result = fn()
    end_time = time.time()
    print('耗时：{:.4f}s'.format(end_time - start_time))
    return fn

@metric
def fib1():
    n,a,b=0,0,1
    while n<100000:
        a,b=b,a+b
        n=n+1
    return 'done'

@metric
def fib2():
    n,a,b=0,0,1
    while n<10000:
        a,b=b,a+b
        n=n+1
    return 'done'

fib1()
fib2()